using System;
using System.Windows.Forms;

namespace Meta
{
	/// <summary>
	/// Summary description for IGUIInterface.
	/// </summary>
	public interface IGUIInterface 
	{
		object Invoke(System.Delegate proc, Object[] args);
		void EditSource(Expression e, bool localizeToExpression, bool raise);
		void Log(object o);
		void RefreshLog();
		void ResetLog();
		void SetStatusMessage(string message);
		OutputWindow MakeOutputWindow();
	}

	public abstract class OutputWindow : Form 
	{
		public abstract SomewhatRichTextWriter TextWriter 
		{
			get;
		}
		public abstract bool WordWrap 
		{
			get;
			set;
		}
	}

	public class StubGUIInterface : IGUIInterface {
		object IGUIInterface.Invoke(Delegate proc, object[] args) 
		{
			return proc.DynamicInvoke(args);
		}

		void IGUIInterface.EditSource(Expression e, bool localize, bool raise) {}
		void IGUIInterface.Log(object o) {}
		void IGUIInterface.RefreshLog() {}
		void IGUIInterface.ResetLog() {}
		void IGUIInterface.SetStatusMessage(string message) {}
		OutputWindow IGUIInterface.MakeOutputWindow() 
		{
			return null;
		}
	}
}
